home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / perl5 / Time::Local.z / Time::Local
Encoding:
Text File  |  2002-10-03  |  2.0 KB  |  67 lines

  1.  
  2.  
  3.  
  4. TTTTiiiimmmmeeee::::::::LLLLooooccccaaaallll((((3333))))                                                  TTTTiiiimmmmeeee::::::::LLLLooooccccaaaallll((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      Time::Local - efficiently compute time from local and GMT time
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.          $time = timelocal($sec,$min,$hours,$mday,$mon,$year);
  13.          $time = timegm($sec,$min,$hours,$mday,$mon,$year);
  14.  
  15.  
  16. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.      These routines are quite efficient and yet are always guaranteed to agree
  18.      with _l_o_c_a_l_t_i_m_e() and _g_m_t_i_m_e().  We manage this by caching the start times
  19.      of any months we've seen before.  If we know the start time of the month,
  20.      we can always calculate any time within the month.  The start times
  21.      themselves are guessed by successive approximation starting at the
  22.      current time, since most dates seen in practice are close to the current
  23.      date.  Unlike algorithms that do a binary search (calling gmtime once for
  24.      each bit of the time value, resulting in 32 calls), this algorithm calls
  25.      it at most 6 times, and usually only once or twice.  If you hit the month
  26.      cache, of course, it doesn't call it at all.
  27.  
  28.      timelocal is implemented using the same cache.  We just assume that we're
  29.      translating a GMT time, and then fudge it when we're done for the
  30.      timezone and daylight savings arguments.  The timezone is determined by
  31.      examining the result of _l_o_c_a_l_t_i_m_e(0) when the package is initialized.
  32.      The daylight savings offset is currently assumed to be one hour.
  33.  
  34.      Both routines return -1 if the integer limit is hit. I.e. for dates after
  35.      the 1st of January, 2038 on most machines.
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.